
var app = getApp();
var ApiUrl = app.globalData.ApiUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    items: [
      { name: 'w', value: '女士' },
      { name: 'm', value: '先生', checked: 'true' }
    ],
    biaoqian: [
      { value: "家", blen: false }, { value: "父母家", blen: false }, { value: "公司", blen: false }, { value: "学校", blen: false }
    ],
    adressInfoDataList: [
      {
        id: 2,
        checked: false,
        name: "李四",
        gender: "女士",
        phone: "18634564444",
        adressName: "北京师范大学",
        houseNumber: "100楼34单元6664",
        detailedAddress: "",
        label: "学校"
      }
    ]
  },
  radioChange: function (e) {
//console.log(e);
    // let ind = e.detail.value;
    // let that = this;
    // for (let i = 0; i < that.data.adressInfoDataList.length;i++){
    //   that.data.adressInfoDataList[i].checked = false;
    // }
    // that.data.adressInfoDataList[ind].checked = true;
    // console.log(that.data.adressInfoDataList); 
    // that.setData({
    //   adressInfoDataList: that.data.adressInfoDataList
    // });
  },
  add_biaoqian(e){
//console.log(e.target.dataset.ind);
    let that = this;
    let ind = e.target.dataset.ind;
    for (let i = 0; i < that.data.biaoqian.length;i++){
      that.data.biaoqian[i].blen = false;
    }
    that.data.biaoqian[ind].blen = true;
    let val = that.data.biaoqian[ind].value;
//console.log(val);
    that.setData({
      biaoqian: that.data.biaoqian
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */

  onLoad: function (options) {
    // var key = wx.getStorageSync('key');
    // wx.request({
    //   url: ApiUrl + "/index.php?act=member_address&op=address_list",
    //   data:{'key':key},
    //   header: {
    //     'content-type': 'application/x-www-form-urlencoded'
    //   },
    // })
    // $('#list-address-valve').click(function () {
    //   $.ajax({
    //     type: 'post',
    //     url: ApiUrl + "/index.php?act=member_address&op=address_list",
    //     data: { key: key },
    //     dataType: 'json',
    //     async: false,
    //     success: function (result) {
    //       checkLogin(result.login);
    //       if (result.datas.address_list == null) {
    //         return false;
    //       }
    //       var data = result.datas;
    //       data.address_id = address_id;
    //       var html = template.render('list-address-add-list-script', data);
    //       $("#list-address-add-list-ul").html(html);
    //     }
    //   });
    // });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})